<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<rich:panel header="#{messages['user.list']}">
	<h:panelGrid ><h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText></h:panelGrid>
	<rich:dataTable id="data" var="usr" value="#{userMgmtBean.userList}" rows="10" width="99%" >
		<rich:column style="text-align:center;width:5%;">
			<f:facet name="header">
				<h:selectBooleanCheckbox id="chkAll" onclick="checkAll(this.form,this)" ></h:selectBooleanCheckbox>
			</f:facet>
			<h:selectBooleanCheckbox id="chk" value="#{usr.markAsAction}"></h:selectBooleanCheckbox>
		</rich:column>
		<rich:column style="text-align:center;width:40%;">
			<f:facet name="header">
				<h:outputText value="#{messages['username']}"></h:outputText>
			</f:facet>
			<h:commandLink value="#{usr.username}" action="#{userMgmtBean.navUserEditAction}" actionListener="#{userMgmtBean.editListener}">
			</h:commandLink>
			<f:param value="#{usr.userId}" id="userId"/>
		</rich:column>
		<rich:column style="text-align:center;width:40%;">
			<f:facet name="header">
				<h:outputText value="#{messages['role.name']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{usr.role.name}"></h:outputText>
		</rich:column>
		<rich:column style="text-align:center;width:15%;">
			<f:facet name="header">
				<h:outputText value="#{messages['status']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{usr.status}"></h:outputText>
		</rich:column>
	</rich:dataTable>
	
	<rich:spacer height="30" />
	
	<rich:datascroller align="left"  for="data" maxPages="20" />

	<rich:spacer height="30" />
	<t:panelGrid columns="3" cellspacing="5">
		<h:commandButton value="#{messages['create']}" styleClass="button" action="#{userMgmtBean.navUserCreationAction}"></h:commandButton>
		<h:commandButton value="#{messages['activate']}" styleClass="button" action="#{userMgmtBean.activeUserList}"></h:commandButton>
		<h:commandButton value="#{messages['deactivate']}" styleClass="button" action="#{userMgmtBean.deactiveUserList}"></h:commandButton>
	</t:panelGrid>

</rich:panel>
